-
Notifications
You must be signed in to change notification settings - Fork 5.4k
build: Enable React Compiler for Browserify builds, fix react-compiler/react-compiler ESLint rule violations
#37480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. Ignoring alerts on: |
✨ Files requiring CODEOWNER review ✨🔑 @MetaMask/accounts-engineers (2 files, +8 -8)
👨🔧 @MetaMask/core-extension-ux (1 files, +0 -1)
🫰 @MetaMask/core-platform (1 files, +3 -0)
🎨 @MetaMask/design-system-engineers (2 files, +4 -1)
🧩 @MetaMask/extension-devs (8 files, +621 -301)
💎 @MetaMask/metamask-assets (2 files, +2 -4)
📜 @MetaMask/policy-reviewers (8 files, +621 -301)
Tip Follow the policy review process outlined in the LavaMoat Policy Review Process doc before expecting an approval from Policy Reviewers. 🔗 @MetaMask/supply-chain (8 files, +621 -301)
|
Builds ready [3eabf52]
UI Startup Metrics (1311 ± 102 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
| })`; | ||
|
|
||
| return ComponentWithRouterHooks; | ||
| return useComponentWithRouterHooks; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Builds ready [d3453be]
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
|
@metamaskbot update-policies |
|
Policies updated. 🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff |
Builds ready [fae3b64]
UI Startup Metrics (1227 ± 101 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
|
@metamaskbot update-policies |
|
Policies updated. 🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff |
Builds ready [9ed8bca]
UI Startup Metrics (1245 ± 92 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [8521341]
UI Startup Metrics (1169 ± 98 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [4c0ef78]
UI Startup Metrics (1256 ± 107 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
4c0ef78 to
1b20e16
Compare
react-compiler/react-compiler ESLint rule violations
Builds ready [249d0ea]
UI Startup Metrics (1245 ± 97 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Motivation
This commit enables React Compiler for Browserify builds, and for ESLint (via the
react-compiler/react-compilerruleset). We can expect long-term UI performance benefits and developer time savings from this change. The Compiler transparently adds memoization code for React components and hooks, among other optimizations, and enforces React best practices in new code.Description
Because enabling React Compiler requires addressing all violations of the
react-compiler/react-compilerrule, this commit contains a large number of formatting changes and renames that do not require close review, alongside refactors and logical changes that do.I would suggest that reviewers primarily focus on whether a given change is problematic, rather than on whether it is necessary. If the motivation for any change is unclear, it's safe to assume that it fixes an error thrown in CI. The objective of this commit is to ship fixes that unblock React Compiler without introducing regressions in functionality or performance. Suggestions on implementing React best practices will be catalogued and addressed in follow-up PRs.
Changelog
CHANGELOG entry: null (non-user facing but regressions possible)
Related issues
react-hooks/rules-of-hooksESLint rule violations #37383Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Enables React Compiler across builds and linting, updates policies/deps, and refactors UI/hooks/tests to meet compiler rules.
babel-plugin-react-compiler) with targeteduisources and exclusions inbabel.config.js.react-compiler/react-compilerrule in ESLint forui/**/*.js,ts,tsx; addeslint-plugin-react-compiler.react-compiler-runtime,babel-plugin-react-compiler,eslint-plugin-react-compiler; update.depcheckrc.yml.useCallback/useMemo/useRef, correctuseEffectdeps/cleanups, replace inline debounced fns; add'use no memo'where needed.instanceof ArraywithArray.isArray, optional chaining, guard undefined IDs, avoid mutating refs unsafely.getIsEstimatedReturnLowto hookuseGetIsEstimatedReturnLowand update call sites.use*Selectortoget*variants (e.g.,getUseSafeChainsListValidation,getUse4ByteResolution).ownerId?: stringin confirm alerts; reducer ignoresundefinedownerId.isNativeAsset,isTokenAsset); adjustAssetPageto use updated asset data.renderHookand new selector/hook names; minor mocks adjusted.Written by Cursor Bugbot for commit 249d0ea. This will update automatically on new commits. Configure here.